package com.tcoiss.kettle.api;

import com.tcoiss.common.core.constant.ServiceNameConstants;
import com.tcoiss.kettle.api.factory.RemoteKettleJobFallbackFactory;
import com.tcoiss.kettle.api.request.JobReq;
import com.tcoiss.kettle.api.response.JobRes;
import com.tcoiss.kettle.common.povo.PageOut;
import com.tcoiss.kettle.common.povo.QueryHelper;
import com.tcoiss.kettle.common.povo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;


/**
 * 作业管理API
 *
 * @author lyf
 */
@FeignClient(contextId = "remoteKettleJobService", value = ServiceNameConstants.KETTLE_SERVICE, fallbackFactory = RemoteKettleJobFallbackFactory.class)
public interface RemoteKettleJobService {


    /**
     * 根据条件查询作业列表
     *
     * @param req {@link QueryHelper}
     * @return {@link Result}
     */
    //@ApiOperation(value = "根据条件查询作业列表")
    @PostMapping("/job/findJobListByPage.do")
    Result<PageOut<JobRes>> findJobListByPage(@RequestBody QueryHelper<JobReq> req);


    /**
     * 全部启动
     *
     * @return {@link Result}
     */
    //@ApiOperation(value = "全部启动")
    @GetMapping("/job/startAllJob.do")
    Result startAllJob();

    /**
     * 单个启动
     *
     * @param id 根据id查询
     * @return {@link Result}
     */
    //@ApiOperation(value = "单个启动")
    @GetMapping("/job/startJob.do")
    Result startJob(Integer id);

    /**
     * 全部停止
     *
     * @return {@link Result}
     */
    //@ApiOperation(value = "全部停止")
    @GetMapping("/job/stopAllJob.do")
    Result stopAllJob();

    /**
     * 单个停止
     *
     * @param id 根据id查询
     * @return {@link Result}
     */
    //@ApiOperation(value = "单个停止")
    @GetMapping("/job/stopJob.do")
    Result stopJob(Integer id);

}
